
<h3>批量发布文章</h3>
<form>
<table class="table table-striped table-bordered table-condensed">
	<tr>
		<th>内容：</th>
		<td><textarea id="content" style="width:600px; height:200px;"></textarea></td>
	</tr>
	<tr>
		<th>时间：</th>
		<td><textarea id="pubdate" style="width:200px; height:120px;"><%=@pubdates %></textarea></td>
	</tr>
</table>
<div><input type="button" id="send" value="提交表单" class="btn btn-primary" /> &nbsp;
	<input type="reset" value="重新填写" class="btn" /></div>
</form>

<script type="text/javascript">
$().ready(function(){

	$.ajaxSetup({  
	    beforeSend: function(xhr) {  
	        xhr.setRequestHeader("X-CSRF-Token", $("meta[name=\"csrf-token\"]").attr("content"));  
	    }  
	});	

	$('#send').click(function(){
		var content = $('#content').val();
		var pubdate = $('#pubdate').val();

		// 提交保存事件
		$.ajax({
			type : 'POST',
			url : '/admin/posting',
			data : { 'pubdate' : pubdate, 'content' : content },
			success: function(d){
				if(d != 0) {
					alert('发布成功数量：' + d);
				} else {
					alert('保存失败，请重新尝试。');
				}
			}
		});
	});
});
</script>
